import request from '../../utils/request'

/**
 * 按条件查询航线
 *
 * @param loadingPort
 * @param destinationPort
 * @param airlineCode
 * @param airlineName
 * @param lesseeCode
 * @param page
 */
export async function getAirlineListForPage({ loadingPort, destinationPort, airline, lesseeCode, page }) {
	return request(apiPath.mc + "/api/airline", {
		method: 'get',
		data: { loadingPort, destinationPort, airline, lesseeCode, page: page.page, size: page.size }
	});
}

/**
 * 根据id获取航线
 *
 * @param id
 */
export async function getAirlineById({ id }) {
	return request(apiPath.mc + "/api/airline/" + id, {
		method: 'get'
	});
}

/**
 * 新增航线
 *
 * @param data
 */
export async function addAirline(data) {
	return request(apiPath.mc + "/api/airline", {
		method: 'post',
		data
	});
}

/**
 * 更新航线
 *
 * @param data
 */
export async function updateAirline(data) {
	return request(apiPath.mc + "/api/airline", {
		method: 'put',
		data
	});
}


/**
 * 根据id删除航线
 *
 * @param id
 */
export async function deleteAirlineById({ id }) {
	return request(apiPath.mc + "/api/airline/" + id, {
		method: 'delete'
	});
}

/**
 * 查询航线List
 *
 */
export async function getAllAirLines(){
	return request(apiPath.mc + "/api/airline/all",{
		method:'get'
	});
}

/**
 * 查询航线下的港口
 *
 */

export async function getAirlineIdPorts({airlineId}){
    return request(apiPath.mc + "/api/airline/port",{
        method:'get',
        data: { airlineId}
    });
}